
#ifndef BABY_H
#define BABY_H

#include "AnimatedEntity.h"
#include "defs.h"
#include "SB.h"

enum eBabyState { Baby_Entering, Baby_Waiting, Baby_EatSuccess, Baby_EatFail, Baby_Exiting, Baby_End };

class Baby : public AnimatedEntity
{
private:
	eBabyPos m_eBabyPos;
	
    eBabyState m_eBabyState;
    float m_fTimeEnterState;
    float m_fStateTimer;
    
    Vector2 m_vPosIn;
    Vector2 m_vPosOut;
    Vector2 m_vCloudPosIn;
    Vector2 m_vCloudPosOut;
    Vector2 m_vHitDirection;
	
	Vector2 m_vMouthPos;
    
    bool m_bSoundPlayed;
    
    bool m_bBabySpawned;
    
    int m_iCloud;
    
    // specific for the chameleon
    Vector4 m_vChameleonColor;
    AnimatedEntity* m_oTongueEyes;
    
public:
    
    Baby(std::string _sName, eBabyPos _eBabyPos, int _iCloud);
    ~Baby() {}
    
    void setup(Vector2 _vPosIn, Vector2 _vPosOut, eBabyPos _iBabyPos);
    void setBabyState(eBabyState _iState);
    int getCloudIndex() { return m_iCloud; }
    
    void update();
    void render();
    
    void updateChameleonColor();

	//Getters
    void setHitDirection(Vector2 _vDirection) { m_vHitDirection = _vDirection; }
    Vector2 getPosIn() { return m_vPosIn; }
    Vector2 getPosOut() { return m_vPosOut; }
    Vector2 getMouthPos() { return m_vPosition /*+ m_vMouthPos*/; }
    float getTimeInState() { return SB::gameTime - m_fTimeEnterState; }
    eBabyState getBabyState() {return m_eBabyState;}
    eBabyPos getBabyPos() { return m_eBabyPos; }
    bool isBabyExiting() { return m_eBabyState != Baby_Entering && m_eBabyState != Baby_Waiting; }
    bool getBabySpawnedBaby() { return m_bBabySpawned; }
    void setBabySpawnedBaby(bool _bBabySpawned) { m_bBabySpawned = _bBabySpawned; }
    void tryDisappear();
    void disappear();
    bool waitingOrEating() { return m_eBabyState == Baby_Waiting || m_eBabyState == Baby_EatFail || m_eBabyState == Baby_EatSuccess; }
};

#endif
